import request from '@/utils/request'

// 查询采购单列表
export function listPurchaseOrder(query) {
  return request({
    url: '/crm/purchaseOrder/list',
    method: 'get',
    params: query
  })
}

// 查询采购单详细
export function getPurchaseOrder(id) {
  return request({
    url: '/crm/purchaseOrder/' + id,
    method: 'get'
  })
}

// 新增采购单
export function addPurchaseOrder(data) {
  return request({
    url: '/crm/purchaseOrder',
    method: 'post',
    data: data
  })
}

export function setPurchaseOrderStatus(data) {
  return request({
    url: '/crm/purchaseOrder/setStatus',
    method: 'post',
    data: data
  })
}


//**设置下单
export function setDownOrder(id) {
  return request({
    url: '/crm/purchaseOrder/setDownOrder',
    method: 'post',
    data: {'id':id}
  })
}

//**设置审批
export function setCheckAuditor(id) {
  return request({
    url: '/crm/purchaseOrder/setAuditor',
    method: 'post',
    data: {'id':id}
  })
}


//**设置验收
export function setCheckAccept(data) {
  return request({
    url: '/crm/purchaseOrder/setCheckAccept',
    method: 'post',
    data: data
  })
}


// 修改采购单
export function updatePurchaseOrder(data) {
  return request({
    url: '/crm/purchaseOrder',
    method: 'put',
    data: data
  })
}

// 删除采购单
export function delPurchaseOrder(id) {
  return request({
    url: '/crm/purchaseOrder/' + id,
    method: 'delete'
  })
}
